package com.xinchen.ssh.demo.service.impl;

import com.xinchen.ssh.demo.dao.IUserDaoTest;
import com.xinchen.ssh.demo.entity.AcctUser;
import com.xinchen.ssh.demo.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.persistence.RollbackException;
import java.util.List;

/**
 * Description：
 *
 * @author Xin Chen
 * @version 1.0
 * @date 2016/12/15 13:47
 * @see 2016/12/15 13:47 Created
 ****************************************/
@Service
@Transactional
public class UserServiceTest implements IUserService {
    private final IUserDaoTest iUserDaoTest;

    @Autowired
    public UserServiceTest(IUserDaoTest iUserDaoTest) {
        this.iUserDaoTest = iUserDaoTest;

    }

    @Transactional(noRollbackFor=NullPointerException.class)
    public void save(AcctUser a) {
        iUserDaoTest.saveA(a);
    }

    @Override
    public List <AcctUser> quary(String hql) {
        return iUserDaoTest.Quary(hql);
    }
}
